var React = require('react');
var ReactDOM = require('react-dom');
var $ = require('jquery');
require('jquery.serializejson');
var bootstrap = require('react-bootstrap');
var Button = require('react-bootstrap').Button;
var urlstr = "http://192.168.3.200/";
var hh = require('../MyHelper/StringHelper');
console.log(hh.add);
//require('../MyHelper/stringformat'); 服务器配置组件
var TopMsg = React.createClass({
    AjaxTest: function () {
        $.ajax({
            url: urlstr + "WebService.cgi",

            type: 'post',
            error: function (xhr, status, error) {
                console.log(xhr);
                console.log(error);
                console.log(statusxhr);
            },
            contentType: "application/x-www-form-urlencoded",
            data: {
                'cityname': '北京',
                'dtype': 'jsonp',
                'key': 'xxxx',
                'name': "hello",
                '_': new Date().getTime()
            },
            dataType: "jsonp",
            //jsonp: "callback", jsonpCallback: "success_jsonpCallback",
            success: function (result) {
                console.log("成功");
                console.log(result);
            }
        });
    },
    MySubmit: function (event) {
        console.log("提交");
        alert('提交');
        //event.preventDefault();
    },
    render: function () {

        return (
            <form
                method='post'
                action='http://192.168.3.200/WebService.cgi'
                onSubmit={this.MySubmit}>
                <div>
                    <h1>
                        hahah
                    </h1>
                    <input type="text" name="name" value="asdasd"></input>
                    <input
                        type="Button"
                        value="开始"
                        className="btn col-sm-1 btn-success "
                        onClick={this.AjaxTest}/>
                    <input type="submit" value="提交"/></div>
            </form>

        );
    }
});
ReactDOM.render(
    <TopMsg id="my-heading"></TopMsg>, document.getElementById('top'));